#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdbool.h>
bool isSelfDiv(int x) {
    if (x == 0) return false;
    int tmp = x;
    while (x != 0) {
        int y = x % 10;
        if (y == 0 || tmp % y != 0) return false;
        x /= 10;
    }
    return true;
}

int* selfDividingNumbers(int left, int right, int* returnSize) {
    int count = 0, i;
    int* num = (int*)malloc(sizeof(int) * 200);
    for (i = left; i <= right; i++) {
        if (i == 0) continue;
        if (isSelfDiv(i)) {
            num[count] = i;
            count++;
        }
    }
    *returnSize = count;
    return num;

}

int main()
{
    int a = 0;
    int arr[22] = { 0 };
    int* x = selfDividingNumbers(1, 22, arr);
    return 0;
}